//
//  usbprn.hpp
//  usbpc
//
//  Created by apps on 12/7/15.
//  Copyright © 2015 apps. All rights reserved.
//

#ifndef usbprn_hpp
#define usbprn_hpp

#include <stdio.h>
#include <libusb.h>
#include "tlink_usb.h"

#ifndef WIN32
typedef uint32_t HANDLE;
typedef unsigned char BYTE;
//typedef unsigned long long DWORD;
typedef unsigned long DWORD;
#else
typedef  int sig_t;
#endif


int GetHandle();
int WriteUSBReg(libusb_device_handle *hdev, int addr, int dat);
int ReadUSBReg(libusb_device_handle *hdev, int addr, int * dat);

int WriteUSBMem(libusb_device_handle *hdev, int addr, uint8_t *lpB, int len /*, int maxlen*/);
int ReadUSBMem(libusb_device_handle * hdev, int addr, uint8_t *lpB, int len /*, int maxlen*/);
int WriteUSBMemCheck(libusb_device_handle *hdev, int addr, uint8_t *lpB, int len , int maxlen);
int ReadUSBMemCheck(libusb_device_handle *hdev, int addr, uint8_t *lpB, int len , int maxlen);

int WriteMem(libusb_device_handle *hdev, int addr, uint8_t *lpB, int len, int type);
int ReadMem(libusb_device_handle *hdev, int addr, uint8_t *lpB, int len, int type);

int IsEVKDevice (libusb_device_handle *h);
int EVKCommand (libusb_device_handle *hdev, int addr, int len, int cmd, /*uint8_t *lpB,*/ int * ptick);


#endif /* usbprn_hpp */
